# Some tweaks to the status line
set -g status-right "%H:%M"
set -g window-status-current-style "underscore"
setw -g window-status-format "#{pane_current_path}".
# If running inside tmux ($TMUX is set), then change the status line to red
%if #{TMUX}
set -g status-bg red
%endif

set -g set-titles on
set -g pane-border-status top

set-option destroy-unattached on

# Enable RGB colour if running in xterm(1)
set-option -sa terminal-overrides ",xterm*:Tc"
set-option -sa terminal-overrides ",rxvt*:Tc"
set-option -sa terminal-overrides ",*256*:Tc"

# Change the default $TERM to tmux-256color
set -g default-terminal "tmux-256color"
# tmux-256color is not as widely recognized as # screen-256color
# So for certain applications will need to change to
#set -g default-terminal "screen-256color"

# No bells at all
#set -g bell-action none

# Keep windows around after they exit
#set -g remain-on-exit on

# Change the prefix key to C-a
#set -g prefix C-a
#unbind C-b
#bind C-a send-prefix

set -g @ressurect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
# Turn the mouse on, but without copy mode dragging
set -g mouse on

set-window-option -g mode-keys vi

# Some extra key bindings to select higher numbered windows
bind _ selectw -t:10
bind ! selectw -t:11
bind @ selectw -t:12
bind '#' selectw -t:13
bind F5 selectw -t:14
bind F6 selectw -t:15
bind ^ selectw -t:16
bind F8 selectw -t:17
bind * selectw -t:18
bind F10 selectw -t:19
bind F11 selectw -t:20
bind F12 selectw -t:21

# A key to toggle between smallest and largest sizes if a window is visible in
# multiple places
bind F set -w window-size

# Keys to toggle monitoring activity in a window and the synchronize-panes option
bind m set monitor-activity
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
bind-key    -T copy-mode-vi v                 send-keys -X begin-selection
bind-key    -T copy-mode-vi y                 send-keys -X copy-selection
 
bind-key -r -T prefix M-k             resize-pane -U 5
bind-key -r -T prefix M-j           resize-pane -D 5
bind-key -r -T prefix M-h           resize-pane -L 5
bind-key -r -T prefix M-l          resize-pane -R 5
bind-key -r -T prefix C-k             resize-pane -U
bind-key -r -T prefix C-j           resize-pane -D
bind-key -r -T prefix C-l           resize-pane -L
bind-key -r -T prefix C-h          resize-pane -R

# Set window size to be the largest to fit on the smallest current viewer
set -g aggressive-resize on
set -g history-limit 121196

unbind \\
bind \\  split-window -h -c '#{pane_current_path}'
unbind -
bind - split-window -v -p 25 -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'

set -s escape-time 0

#DWM compatability
bind Enter split-window -v -c '#{pane_current_path}'\; run-shell '~/bin/.tmux-layout-dwindle.sh'
bind j select-pane -t :.+
bind k select-pane -t :.-

#run-shell ~/workspace/tmux-music/music.tmux
set -g status-right "♫ #{music_status} #{_artist}: #{track} | %a %h-%d %H:%M "

#set -g status-right "♫ #{spotify_status} #{spotify_artist}: #{spotify_track} | %a %h-%d %H:%M "
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'robhurring/tmux-spotify'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'christoomey/vim-tmux-navigator'
run -b '~/.tmux/plugins/tpm/tpm'
